# This is the namespace convention for a tool that is part of Vanilla - Vanilla.Tool.NameOfTool.
# This doesn't have to be used for third party applications.
namespace Vanilla.Tools.ImageViewer

# Import the Vanilla.UI namespace. This contains things like Gadgets.
import Vanilla.UI
# Import the Vanilla namespace, which gives us Files and things.
import Vanilla

# This defines a class called ImageViewerWindow, that is a subclass of MainWindow
class ImageViewerWindow (MainWindow):
	# The image gadget inside this window. Note that what is written as "int my_variable" in C/C#/.. is "my_variable as int" in Boo.
	public Image as ImageGadget

	# The constructor - sets up the ImageViewerWindow. f is the file of the image to open.
	def constructor (f as File):
		# This calls MainWindow's constructor, which takes the window's title as it's argument.
		# ${...} in a string means "place ... as a string inside this string", so if f was "poop", "blah${f}aaah" would become "blahpoopaaah"
		super("${f.Name} - Image Viewer")
		# Creates the ImageGadget inside. Self refers to this object, and the first argument to create most gadgets is the gadget you want
		# it created inside, so this will create the ImageGadget inside this window. The f, of course, tells ImageGadget what file to open.
		# Note that we don't have to write "new ImageGadget(self, f)" like in C#.
		Image = ImageGadget(self, f)

# This is the class that is actually loaded when the tool is used. The constructor is sent the directory the tool is executed in. This
# can be used to load data files that come with the program. The IOpen interface, and it's Open method, "open" the tool, which generally
# means to open a window with a new or default document. The IOpenFile interface and the OpenFile method are for opening a file with this
# tool.
class ImageViewerTool (UI.Tool, IOpen, IOpenFile):
	def constructor (p as File):
		pass

	def Open ():
		ImageViewerWindow(File("screenshot.png"))

	def OpenFile (f as File):
		ImageViewerWindow(f)
